<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace longbingcore\printer;

header("Content-type: text/html; charset=utf-8");
define("USER", "xxxxxxxxx");
define("UKEY", "xxxxxxxxxxxx");
define("SN", "xxxxxxxxx");
define("IP", "api.feieyun.cn");
define("PORT", 80);
define("PATH", "/Api/Open/");
define("STIME", time());
define("SIG", sha1(USER . UKEY . STIME));
$orderInfo = "<CB>测试打印</CB><BR>";
$orderInfo .= "名称　　　　　 单价  数量 金额<BR>";
$orderInfo .= "--------------------------------<BR>";
$orderInfo .= "饭　　　　　 　10.0   10  10.0<BR>";
$orderInfo .= "炒饭　　　　　 10.0   10  10.0<BR>";
$orderInfo .= "蛋炒饭　　　　 10.0   100 100.0<BR>";
$orderInfo .= "鸡蛋炒饭　　　 100.0  100 100.0<BR>";
$orderInfo .= "西红柿炒饭　　 1000.0 1   100.0<BR>";
$orderInfo .= "西红柿蛋炒饭　 100.0  100 100.0<BR>";
$orderInfo .= "西红柿鸡蛋炒饭 15.0   1   15.0<BR>";
$orderInfo .= "备注：加辣<BR>";
$orderInfo .= "--------------------------------<BR>";
$orderInfo .= "合计：xx.0元<BR>";
$orderInfo .= "送货地点：广州市南沙区xx路xx号<BR>";
$orderInfo .= "联系电话：13888888888888<BR>";
$orderInfo .= "订餐时间：2014-08-08 08:08:08<BR>";
$orderInfo .= "<QR>http://www.dzist.com</QR>";
wp_print(SN, $orderInfo, 2);
function addprinter($snlist)
{
    $content = ["user" => USER, "stime" => STIME, "sig" => SIG, "apiname" => "Open_printerAddlist", "printerContent" => $snlist];
    $client = new HttpClient(IP, PORT);
    if(!$client->post(PATH, $content)) {
        echo "error";
    } else {
        echo $client->getContent();
    }
}
function wp_print($printer_sn, $orderInfo, $times)
{
    $content = ["user" => USER, "stime" => STIME, "sig" => SIG, "apiname" => "Open_printMsg", "sn" => $printer_sn, "content" => $orderInfo, "times" => $times];
    $client = new HttpClient(IP, PORT);
    if(!$client->post(PATH, $content)) {
        echo "error";
    } else {
        echo $client->getContent();
    }
}
function queryOrderState($index)
{
    $msgInfo = ["user" => USER, "stime" => STIME, "sig" => SIG, "apiname" => "Open_queryOrderState", "orderid" => $index];
    $client = new HttpClient(IP, PORT);
    if(!$client->post(PATH, $msgInfo)) {
        echo "error";
    } else {
        $result = $client->getContent();
        echo $result;
    }
}
function queryOrderInfoByDate($printer_sn, $date)
{
    $msgInfo = ["user" => USER, "stime" => STIME, "sig" => SIG, "apiname" => "Open_queryOrderInfoByDate", "sn" => $printer_sn, "date" => $date];
    $client = new HttpClient(IP, PORT);
    if(!$client->post(PATH, $msgInfo)) {
        echo "error";
    } else {
        $result = $client->getContent();
        echo $result;
    }
}
function queryPrinterStatus($printer_sn)
{
    $msgInfo = ["user" => USER, "stime" => STIME, "sig" => SIG, "apiname" => "Open_queryPrinterStatus", "sn" => $printer_sn];
    $client = new HttpClient(IP, PORT);
    if(!$client->post(PATH, $msgInfo)) {
        echo "error";
    } else {
        $result = $client->getContent();
        echo $result;
    }
}

?>